<?php

namespace App\Models\airline\base;

use App\Http\Controllers\Admin\AirLine\Base\Type;
use App\Models\AdminModel;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model as BaseModel;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;

class RouteModel extends BaseModel
{
    use HasFactory, SoftDeletes;

    protected $table = 't_airline_base_route';

    protected $primaryKey = 'id';

    public $timestamps = true;

    const CREATED_AT = 'created_at';
    
    const UPDATED_AT = null;

    protected $guarded = [];

    protected $hidden = [
        'deleted_at',
    ];


    //创建人
    public function create_admin(): BelongsTo {
        return $this->belongsTo(AdminModel::class, 'created_admin_id');
    }

    //分类
    public function type(): BelongsTo {
        return $this->belongsTo(TypeModel::class, 'type_id');
    }

    //始发港
    public function start_port(): BelongsTo {
        return $this->belongsTo(PortModel::class, 'start_port_id');
    }

    //目的港
    public function arrive_port(): BelongsTo {
        return $this->belongsTo(PortModel::class, 'arrive_port_id');
    }


}
